[EuiModal] Source order adjusted to annouce modal title before close#8233
[EuiModal] Source order adjusted to annouce modal title before close#8233Cedgo1997 wants to merge 7 commits intoelastic:mainfrom
Conversation
…op through cloneElement
- You can whether to set onClose to EuiModal or EuiModalHeader, it'll work both, but no if it's not added to any of them.
|
👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually? |
|
@Cedgo1997 Thank you for the contributions. We're looking for some time to review these, we'll be back to you shortly with feedback. |
|
@Cedgo1997 thanks a lot again, for opening this! I tried a similar approach with #8202 (I must admit less sophisticated 🙂), and the team raised some valid concerns, so I closed it. You can read the original comment here. In summary, the implementation in this PR:
I'll double-check with the team and close this PR as we might just close the original issue as unplanned. We highly appreciate that you took the time to make this contribution, and also the quality of it, which I find really good. So please don't feel discouraged. |
|
@acstll Thank you very much for taking the time to review my PR. This was really helpfull. My best regards! |
Summary
This PR introduces a workaround to solve the issue #7222, the following updates to the
EuiModalandEuiModalHeadercomponents, in addition to adjustments in the tests and styles moved based on the changed components.EuiModal Enhancements:
onClosedown to children that accept it.childrenprocessing to enhance each child with theonCloseprop if applicable.EuiModalHeader Enhancements:
onCloseprop to support closing the modal directly from the header.EuiButtonIcon) with proper accessibility (aria-label), now this close button is under the title, so it'll be annouce after.Changes in
modal.tsxChildWithOnClosetype to ensure children acceptingonCloseare type-safe.React.Children.mapandReact.cloneElementto injectonCloseprop into child components.EuiModalHeader.Changes in
modal_header.tsxEuiButtonIconwith styles and localization viaEuiI18n.onCloseprop to facilitate parent-driven close behavior.Detailed Changes
modal.tsxonClosewill receive it automatically, making the component more flexible.modal_header.tsxmodal.tsxandmodal_header.tsxstyles were affected only to match reallocated code.QA
Remove or strikethrough items that do not apply to your PR.
General checklist
@defaultif default values are missing) and playground toggles